package com.itheima.demo;

import java.util.Scanner;

public class Demo004 {
    //求5的阶乘,使用递归;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入整数i(i>=0&&i<=25):");
        System.out.println(getJc(sc.nextInt()));
    }

    private static long getJc(int i) {
        //求5的阶乘的方法;
        if (i == 1) {
            return 1;
        } else {
            return i * getJc(i - 1);
        }
    }
}
